<?php
  include_once('../class_timer.php');
  require_once('./config.php');
  require_once('./tool_benchmark.php');

  function work1($_nb_iter){
    $array = array();
    for($i=0;$i<$_nb_iter;++$i){
      array_push($array,$i);      
    }
  }

  function work2($_nb_iter){
    $array = array();
    for($i=0;$i<$_nb_iter;++$i){
      $array[] = $i;      
    }
  }

  function work3($_nb_iter){
    $array = array();
    for($i=0;$i<$_nb_iter;++$i){
      $array[$i] = $i;      
    }
  }

  $time1 = new Timer();
  $a = null;
  $array_functions = array('work1', 'work2', 'work3');
  Tool_benchmark::bench_array_functions($array_functions,$a,$nb_experiences,$time1);
  $array_names = array('array_push()', 'array[]', '$array[$i]');
  Tool_benchmark::print_info_bench($array_names,$time1);
?>
